package com.javasm.crm.mapper.goodsmapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.javasm.crm.domin.entity.productEntity.GoodsVo;
import com.javasm.crm.domin.entity.productEntity.ProductVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GoodsVoMapper extends BaseMapper<GoodsVo> {
    @Select("SELECT g.*,p.product_model,pb.brand_name,pc.color_name,pt.type_name,pb.brand_id,pc.color_id,pt.type_id\n" +
            " FROM goods_info g INNER JOIN product_info p on g.good_productid=p.product_id INNER JOIN product_brand pb on p.product_brandid=pb.brand_id \n" +
            "INNER JOIN product_color pc on p.product_colorid=pc.color_id INNER JOIN \n" +
            "product_type pt on p.product_typeid=pt.type_id"+" ${ew.customSqlSegment}")
    List<GoodsVo> queryall(Page<GoodsVo> pagination, @Param(Constants.WRAPPER) QueryWrapper<GoodsVo> exampleQueryWrapper);

}